using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Hostal.Bussines.Entities;

namespace Hostal.Bussines.Repository.Mapping
{
    public class HabitacionMap : EntityTypeConfiguration<Habitacion>
    {
        public HabitacionMap()
        {
            // Primary Key
            this.HasKey(t => t.IdHabitacion);

            // Properties
            // Table & Column Mappings
            this.ToTable("Habitacion");
            this.Property(t => t.IdHabitacion).HasColumnName("IdHabitacion");
            this.Property(t => t.TipoHabitacion_Id).HasColumnName("TipoHabitacion_Id");
            this.Property(t => t.Precio).HasColumnName("Precio");
            this.Property(t => t.NroHabitacion).HasColumnName("NroHabitacion");
            this.Property(t => t.Estado).HasColumnName("Estado");

            // Relationships
            this.HasRequired(t => t.TipoHabitacione)
                .WithMany(t => t.Habitacions)
                .HasForeignKey(d => d.TipoHabitacion_Id);

        }
    }
}
